package com.yyaccp.itrip.auth.controller;

import com.yyaccp.itrip.auth.service.UserService;
import com.yyaccp.itrip.beans.domain.ItripUser;
import com.yyaccp.itrip.beans.dto.Dto;
import com.yyaccp.itrip.utils.DtoUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 天天向上 （john.yi@qq.com）
 * @date 2020/11/16.
 */
@RequestMapping("/api")
@Controller
public class RegController {
    @Autowired
    private UserService userService;

    @RequestMapping("/registerbyphone")
    @ResponseBody
    public Dto registerbyphone(@RequestBody ItripUser user) {
        userService.regByPhone(user);
        return DtoUtil.returnSuccess();
    }

    @RequestMapping("/doregister")
    @ResponseBody
    public Dto doregister(@RequestBody ItripUser user) {
        userService.regByMail(user);
        return DtoUtil.returnSuccess();
    }

    @RequestMapping("/ckusr")
    @ResponseBody
    public Dto ckusr(String name) {
        return DtoUtil.returnSuccess();
    }
}
